//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    modalName:null,
    type:0,
    conpanylist:[
      // {
      //   KeyNo:'123456',
      //   Name:'测试公司',
      //   OperName:'张三',
      //   StartDate:'2024-04-12',
      //   CreditCode:'52353523523523q',
      // },
      // {
      //   KeyNo:'567890',
      //   Name:'正是公司',
      //   OperName:'李四',
      //   StartDate:'2023-01-12',
      //   CreditCode:'wqqe53523523523q',
      // },
    ],
    companyName:"",
    creditCode:"",
    corporation:""
  },
  onLoad: function (options) {
    //调取企查查接口
    this.qccCompanyInfo(options.companyInfo);
  },
  //企查查接口
  qccCompanyInfo: function (companyInfo) {
    console.log(999,companyInfo)//接收到参
    //查询企查查
    let _this=this
    wx.request({
      url: app.globalData.onlineUrl+'api/admin/getQCC',
      data: {
        searchName:companyInfo
      },
      header:{'content-type': 'application/json'},
      method:"POST",
      dataType:"json",
      success: res => {
        console.log(333,res.data.data)
        _this.setData({
          conpanylist: res.data.data,
        });
      }
    })
  },
  //立即认证
  authentication: function (e) {
    console.log(123,e.currentTarget.dataset.id);
    //
    let dataArry=e.currentTarget.dataset.id.split(',');
    console.log(123,dataArry);
    this.setData({
      modalName: "RadioModal",
      companyName:dataArry[0],
      creditCode:dataArry[1],
      corporation:dataArry[2],
    })
  },
  authenticationProgram: function () {
    if(this.data.type){
      let _this=this;
      wx.navigateTo({
        url: '/pages/authen/index?type='+_this.data.type+'&companyName='+_this.data.companyName+'&creditCode='+_this.data.creditCode+'&corporation='+_this.data.corporation
      })
    }else{
      wx.showToast({
        title: '请先选择服务项目',
        icon: 'none'
      });
    }
  },
  changeChecked: function (e) {
    this.data.type=e.detail.value;
  },
  hideModal: function () {
    this.setData({
      modalName: null
    })
  },

  
})
